import { GetRequest, PostRequest } from '@/utils/request'
import type { Response } from '@/utils/request'

/**
 * HVN随机生成三条推荐语音
 */
export type SkillModel = {
  id: number
  skillTitle: string
  skillContext: string
  skillPic: string | null
  skillCatelog: number
  skillApplyApplianceType: string
  skillPriority: number
}
/**
 *
 * @returns 随机获取三条内容
 */
export function getSkillListLight(): Promise<Response<SkillModel[] | null>> {
  return GetRequest('/api/hvnSkill/skillListLight', {})
}

/**
 * 随机获取一条内容
 * @param skillCatelog
 * @returns
 */
export function refreshskillListLight(skillCatelog: number): Promise<Response<SkillModel>> {
  return PostRequest('/api/hvnSkill/refreshskillListLight', { skillCatelog })
}

export type AlarmModel = {
  sd: string
  r: string
  t: string
  u: number
  id: number
  m: string
  week: string
}
export function getAlarmList(haId: string): Promise<Response<AlarmModel[] | null>> {
  return GetRequest('/api/WxuserHaidInfo/alarm/' + haId + '/getList', {})
}

/**
 * 新增一条闹钟
 */
export function addAlarm(haId: string, m: string, r: string, t: string, u: number): Promise<Response<string>> {
  return PostRequest('/api/WxuserHaidInfo/alarm/' + haId + '/add', { data: { m, r, t, u } })
}

/**
 * 删除一条闹钟
 */
export function deleteAlarm(
  haId: string,
  data: { m: string; r: string; t: string; u: number; id: number }
): Promise<Response<string>> {
  return PostRequest('/api/WxuserHaidInfo/alarm/' + haId + '/delete', { data: data })
}

/**
 * 更新一条闹钟
 */
export function updateAlarm(
  haId: string,
  data: { m: string; r: string; t: string; u: number; id: number }
): Promise<Response<string>> {
  return PostRequest('/api/WxuserHaidInfo/alarm/' + haId + '/update', { data: data })
}

/**
 * 生成对应的语音内容列表
 */
export function getVoiceList(
  skillCatelog: number,
  page: number,
  pageSize: number
): Promise<Response<SkillModel[] | null>> {
  return PostRequest('/api/hvnSkill/skillList/' + skillCatelog, {
    page,
    pageSize,
  })
}
